import request from '@/utils/request';
import domain from '@/utils/domain';

const api_base = domain.BASE_API_URL;
export default { api_base };
//  产品列表
export const productList = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/product/list',
        method: 'POST',
        data
    });
};
// 选择产品品类
export const CatetList = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/common/cate-list',
        method: 'POST',
        data
    });
};
// 新建产品
export const productCreate = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/product/create',
        method: 'POST',
        data
    });
};
// 新建产品
export const productEdit = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/product/edit',
        method: 'POST',
        data
    });
};
// 删除产品
export const productDel = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/product/del',
        method: 'POST',
        data
    });
};
// 查看
export const productInfo = (params: any) => {
    return request({
        url: '/scrm-api/console/sale/product/info',
        params
    });
};
// 上架、批量上架
export const productUpstate = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/product/upState',
        method: 'POST',
        data
    });
};
// 下架、批量下架
export const productDownstate = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/product/downState',
        method: 'POST',
        data
    });
};
// 预览产品
export const productPreview = (params: any) => {
    return request({
        url: '/scrm-api/console/sale/product/preview',
        params
    });
};
// 导入产品
export const productImport = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/product/import',
        method: 'POST',
        timeout: 60000,
        data
    });
};

// 最近一次产品品类
export const getLastProductCate = () => {
    return request({
        url: '/scrm-api/console/sale/product/last-product-cate',
        method: 'get'
    });
};
